home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
dostips5.arc
/
DOSCOLOR
< prev
next >
Wrap
Text File
|
1986-12-17
|
8KB
|
237 lines
EGA at Length
(PC World July 1986 Star-Dot-Star)
The IBM Enhanced Graphics Adapter is capable of displaying 43
lines of text when used with an Enhanced Color Display or a Monochrome
Display. However, the IBM-supplied ANSI.SYS device driver does not
handle scrolling properly in the 43-line mode; only the upper 25 lines
of the screen are active.
The solution is to modify ANSI.SYS to accomodate the additional
lines. You will also have to modify COMMAND.COM so the CLS command
will work properly. The steps apply to IBM's DOS 3.10 only; do not
attempt to use them with any other DOS version.
First make a copy of ANSI.SYS called ANSI43.SYS, make a copy of
COMMAND.COM, and then follow the steps below to perform the patch.
Remember to edit CONFIG.SYS to refer to the ANSI43.SYS driver.
A>copy ansi.sys ansi43.sys
A>debug ansi43.sys
-e 29d 90 90
-e 2a1 90 90
-e 27c 2b
-e 283 2a
-e 50c 2b
-e 58f 2b
-w
Writing 0673 bytes
-q
A>debug command.com
-e 263b 2a
-w
Writing 0673 bytes
-q
-----------------------------------------------------------------
The Wonderful World of Color
(PC World August 1986 The Help Screen)
DOS contains a device driver called ANSI.SYS that can enhance the
PC's rudimentary default screen and keyboard drivers. Once the ANSI.SYS
driver is installed, it accepts commands that control cursor movement
and clear the screen, reassign key definitions, and set screen color.
ANSI.SYS is not, however, a panacea. While ANSI.SYS can give color to
DOS, many programs, including the BASIC interpreter, bypass installed
screen and keyboard drivers in favor of their own (complete with screen
color choices and key definitions).
To install ANSI.SYS, copy that file from your DOS disk to the root
directory of the disk you use to start the PC. With EDLIN or a word
processor that can create ASCII files, edit (or create) the root
directory's CONFIG.SYS file. Add to the beginning of the file the line
DEVICE=ANSI.SYS. Note that CONFIG.SYS must reside in the root
directory. On a hard disk system, however, you can keep ANSI.SYS in
another directory; for example, \DOS. In that case, assuming the hard
disk is drive C:, the first line of CONFIG.SYS should be:
DEVICE=C:\DOS\ANSI.SYS
Save CONFIG.SYS and reboot the PC. Whenever the PC is started or
reset, DOS looks to the root directory of the system disk to install
the drivers indicated in CONFIG.SYS.
ANSI.SYS commands consist of an Escape character (ASCII 27)
followed by a short sequence of characters. When an Escape sequence
is sent to the screen, ANSI.SYS intercepts it. If the Escape sequence
is a valid ANSI.SYS command, the driver performs the appropriate
function and the command is not displayed. Escape sequences that are
not ANSI.SYS commands are ignored by the driver and displayed.
The DOS command PROMPT enables you to modify the DOS prompt to
include Escape and the other characters used in ANSI.SYS commands.
Because those characters are sent to the screen each time the prompt
is displayed, PROMPT is commonly used to command ANSI.SYS. For example,
with the ANSI.SYS driver installed the command:
PROMPT $e[1;33m$n$g <Enter>
will yield yellow characters. ($n$g specifies that the name of the
default drive and the greater-than symbol are to be included in the
DOS prompt -- they are not ANSI.SYS commands. $e specifies the Escape
character, which cannot be entered directly from the keyboard.)
Of course, remembering the ANSI.SYS code number for a particular
color is difficult. The batch file COLOR.BAT is a modification of a
listing from "Designer Screens" (PC World November 1985) and eliminates
the need for an elephantine memory or an ANSI.SYS Set Graphics
Rendition (SGR) chart. Enter and save COLOR.BAT and COLOR.HLP. With
COLOR.BAT, DOS's screen colors can be set using English.
The command COLOR NORMAL BLACK BACKCYAN, for example, produces
black characters on a cyan background. The parameter NORMAL is included
first to ensure that the intensity attribute is off -- with intensity
on, the parameter BLACK produces gray characters.
If COLOR.BAT is called without a subsequent parameter or with the
parameter HELP, the help screen COLOR.HLP is displayed. It contains
instructions for using COLOR.BAT and lists the batch file's valid
parameters. Note that COLOR.BAT operates with ECHO off. When ECHO
is off, the DOS prompt is not displayed; ANSI.SYS commands contained
in the prompt will not be executed until ECHO is turned on and the
prompt is displayed. COLOR.BAT thus executes an ECHO ON after each
PROMPT/ANSI.SYS command. Just before ending, COLOR.BAT issues the
command PROMPT $p$g, specifying that the DOS prompt consist of the
current path followed by the greater-than symbol.
COLOR.BAT:
echo off
cls
echo Please wait ...
if %1.==. goto help
goto %1
:normal
prompt $e[0m
goto exit
:bright
prompt $e[1m
goto exit
:reverse
prompt $e[7m
goto exit
:black
prompt $e[30m
goto exit
:red
prompt $e[31m
goto exit
:green
prompt $e[32m
goto exit
:brown
prompt $e[33m
goto exit
:blue
prompt $e[34m
goto exit
:magenta
prompt $e[35m
goto exit
:cyan
prompt $e[36m
goto exit
:white
prompt $e[37m
goto exit
:backblack
prompt $e[40m
goto exit
:backred
prompt $e[41m
goto exit
:backgreen
prompt $e[42m
goto exit
:backbrown
prompt $e[43m
goto exit
:backblue
prompt $e[44m
goto exit
:backmagenta
prompt $e[45m
goto exit
:backcyan
prompt $e[46m
goto exit
:backwhite
prompt $e[47m
goto exit
:exit
shift
echo on
echo off
cls
echo Please wait ...
if not .==.%1 goto %1
prompt $p$g
goto done
:help
type color.hlp
:done
COLOR.HLP
ANSI.SYS and CONFIG.SYS (containing
the line DEVICE=ANSI.SYS) must be
accessible when the PC is started.
Type COLOR and then your choice(s) of
character intensity and/or color,
and/or background color (indicated
by the prefix `back') selected from
the following list of parameters.
For color displays:
black backblack
red backred
green backgreen
brown backbrown
blue backblue
magenta backmagenta
cyan backcyan
white backwhite
Fro color and monochrome displays:
normal
bright
reverse
For example: COLOR bright red backgreen
COLOR.BAT for DOS 2.xx Users
(PC World December 1986 The Help Screen)
In the COLOR.BAT file described in PC World August 1986 The Help
Screen (see above), the BACKGREEN parameter produces the "Label not
found" error message. This is because PC-DOS 2.00, 2.10, and their
MS-DOS cousins do not recognize batch file labels that are more than
8 characters long (excluding the requisite colon). DOS 3.00 and 3.10,
on the other hand, simply ignore any label characters after the first
8 and continue to execute their batch files. (DOS 1.xx, of course,
does not recognize any batch file labels or GOTO commands.) That's
why COLOR.BAT, running under DOS 2.xx, cannot GOTO the label :BACKGREEN
-- it's one character too long.
There are two quick, easy ways to fix COLOR.BAT for DOS 2.xx.
The first is to simply insert a space between the 8th and 9th
characters in a label, thus yielding:
:BACKBLAC K
:BACKGREE N
:BACKBROW N
:BACKMAGE NTA
:BACKWHIT E
The contents of the help file, COLOR.HLP, which includes a list
of COLOR.BAT's acceptable parameters, needn't be altered, because you
can use parameters that exceed 8 characters -- DOS will ignore the
excess and locate the appropriate 8-character label.
The other method uses the letter B instead of BACK as the prefix
for the background color labels. Thus, BACKMAGENTA becomes BMAGENTA.
The COLOR.BAT file you have can easily be modified by globally
replacing all occurrences of BACK with B using an ASCII word processor.
Remember to do the same to COLOR.HLP's list of parameters but not, of
course, to the word background in the sixth line of COLOR.HLP.